class Stack(object):
    def __init__(self, maxsize=16):
        self.max_size = maxsize
        self.top = -1
        self.stack = [None] * self.max_size

    def push(self, e):
        assert not self.is_full(), "栈满"
        self.top += 1
        self.stack[self.top] = e
        return True

    def pop(self):
        assert not self.is_empty(), "栈空"
        res = self.stack[self.top]
        self.top -= 1
        return res

    def get_top(self):
        assert not self.is_empty(), "栈空"
        return self.stack[self.top]

    def size(self):
        return self.top+1

    def is_empty(self):
        if self.top == -1:
            return True
        return False

    def is_full(self):
        if self.top == self.max_size:
            return True
        return False


if __name__ == "__main__":
    st = Stack(3)
    print(st.is_full())
    print(st.is_empty())
    st.push(1)
    print(st.size())
    st.push(2)
    print(st.size())
    st.push(3)
    print(st.size())

    res = st.pop()

    print(res)

